package thread;

/**
 * Created with IntelliJ IDEA.
 * Description: 线程的状态 NEW,TERMINATED,RUNNABLE
 * User: 王圆豪
 * Date: 2025-04-23
 * Time: 23:55
 */
public class Demo13 {
    public static void main(String[] args) throws InterruptedException {
        Thread thread = new Thread(()->{
            while (true) {
                System.out.println("Hello thread!");
                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    throw new RuntimeException(e);
                }
            }
        });
        System.out.println(thread.getState());//NEW
        thread.start();
//        Thread.sleep(1000);
        System.out.println(thread.getState());//TERMINATED, RUNNABLE
    }
}
